package com.example.javaee.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

@Data
@TableName("user")
public class User
{
    @TableId(value="id",type = IdType.AUTO)
    private Integer id;
    private String username;
    private String password;
    private String salt;        //随机生成的盐，用于密码的加盐加密
    private String email;

    private String avatar;
    private Integer type;   //0为普通用户，1为管理员
    private Integer status;

    private String college;

    private String major;

    private Integer grade;

    @TableField(value = "activationCode")
    private String activationCode;
    @TableField(value = "headerUrl")
    private String headerUrl;
    @TableField(value = "createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", salt='" + salt + '\'' +
                ", email='" + email + '\'' +
                ", type=" + type +
                ", status=" + status +
                ", activationCode='" + activationCode + '\'' +
                ", headerUrl='" + headerUrl + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
